package pe.com.csi.pm.regexiv.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class UDate {

	public static String parseDate(String date, String pattern) {
		// Fri Sep 09 17:45:48 COT 2011
		DateFormat df = new SimpleDateFormat("d MMM yyyy HH:mm:ss G");
		Date dt = null;
		try {
			dt = df.parse(date);
			df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss G");
			return df.format(dt);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return "";
	}

	public static void main(String args[]) {
		Date d = new Date();
		String f = d.toLocaleString();
		System.out.println(parseDate(f, ""));
	}

	public static String fecha(Date d) {
		String f = "";
		try {
			SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
			f = sd.format(d);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return f;
	}

}
